<template>
	<view class="orderDetails">
		<!-- <navCom navName="详情" @previous="previous"></navCom> -->
		<view class="order_box" v-for="(item,index) in dev" :key="index">
			<view class="time_box my-mgt-10 my-pdl-15">{{item.timeValue}}日</view>
			<view class="contant my-mgl-15">
				<view class="bor_fir">
					<view class="">
						{{timer==='DAY'?'今日':'当月'}}团队{{currTab==='交易额'?'交易量':''||currTab==='交易笔数'?'交易笔数':''||currTab==='机具激活'?'机具激活':''}}
					</view>
					<view class="" v-if="currTab==='交易额'">
						{{item.teamAmount|| 0}}元
					</view>
					<view class="" v-else-if="currTab==='交易笔数'">
						{{item.teamCount || 0}}元
					</view>
					<view class="" v-else>
						{{item.teamCount || 0}}元
					</view>
				</view>
				<view class="bor_fir">
					<view class="">
						{{timer==='DAY'?'今日':'当月'}}我的{{currTab==='交易额'?'交易量':''||currTab==='交易笔数'?'交易笔数':''||currTab==='机具激活'?'机具激活':''}}
					</view>
					<view class="" v-if="currTab==='交易额'">
						{{item.myAmount|| 0 }}元
					</view>
					<view class="" v-else-if="currTab==='交易笔数'">
						{{item.myCount|| 0}}元
					</view>
					<view class="" v-else>
						{{item.myCount || 0}}元
					</view>
				</view>
				<view class="bor_fir" v-if="currTab !=='机具激活'">
					<view class="">
						{{timer==='DAY'?'今日':'当月'}}直营{{currTab==='交易额'?'交易量':''||currTab==='交易笔数'?'交易笔数':''||currTab==='机具激活'?'机具激活':''}}
					</view>
					<view class="" v-if="currTab==='交易额'">
						{{item.nextAmount|| 0}}元
					</view>
					<view class="" v-else-if="currTab==='交易笔数'">
						{{item.nextAmount|| 0}}元
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import navCom from "@/components/navCom/navCom.vue";
	import { perdataApi } from "@/api/results.js"
	export default {
		components: {
			navCom,
		},
		data() {
			return {
				currTab:'',
				ids:1,
				timer:'DAY',
				dev:[]
			};
		},
		onLoad(option) {
			this.currTab = option.currTab;
			this.ids = option.ids
			this.timer = option.acoun
			this.getData()
		},
		methods:{
			// 获取数据
			async getData(){
				let params = {
					companyId: this.ids,
					interval:30,
					timeType:this.timer
				}
				// uni.showLoading({
				// 	title: "正在加载中...."
				// })
				var url =''
				if (this.currTab === '交易额') {
					url = "/user/achieve/transfer/data/list"
				} else if (this.currTab === '交易笔数') {
					url = "/user/achieve/transfer/number/data/list"
				} else if (this.currTab === '机具激活') {
					url = "/user/achieve/activation/number/data/list"
				}
				const res = await perdataApi(url,params)
				if(res.statusCode ===200 ){
					// uni.hideLoading()
					this.dev = res.data.data
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.orderDetails{
		width: 100%;
		height: 100vh;
		background: #FAFAFA;
		.order_box{
			width: 100%;
			height: 350rpx;
			.time_box{
				width: 100%;
				height: 60rpx;
				line-height: 60rpx;
				background: #E8E8E8;
				font-size: 24rpx;
				font-weight: 400;
				color: #000000;
			}
			.contant{
				width: 92%;
				height: 300rpx;
				.bor_fir{
					width: 100%;
					height: 100rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					border-bottom: 1rpx solid #F2F2F2;
					font-size: 26rpx;
					font-weight: 400;
					color: #666666;
				}
			}
		}
	}
</style>
